-- attack_burn
-- created by zhuangsl
-- 攻击附加燃烧

return {
    apply = function(prop, baseValue)
        return prop[2];
    end,

    -- 攻击触发
    trigger = function(who, prop, arg)
        local target = arg;

        -- 概率触发
        local rand = DungeonM.getRandSeed("attack_burn") % 1000;

        if (rand > prop[3]) then
            return;
        end

        local propId = PropM.getPropId("burn");
        local v = math.modf(ME.user:queryAttrib("magic") * prop[2] / 1000);

        -- 减益状态
        local effectRound = CombatM.getRound() + prop[4];
        local arr = ({ propId, 1, v, effectRound, });

        local condition = {
            ["prop"] = arr,
            ["end_round"] = effectRound,
        };

        -- 附加状态
        CombatStatusM.applyStatus(target, "burn", condition);


        -- 触发特技发动事件
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1] });

        return arr;
    end,

    record = function(target, prop, path)
        return false;
    end
};
